//
//  OrderCodeCell.m
//  PropertyMananger
//
//  Created by bh on 17/1/16.
//  Copyright © 2017年 BH. All rights reserved.
//

#import "OrderCodeCell.h"

@implementation OrderCodeCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *cellID = @"OrderCodeCellID";
    OrderCodeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if(cell == nil) {
        cell = [[OrderCodeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    //选中cell的颜色 -无色
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    return cell;
    
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        self.orderCodeLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.orderCodeLabel];
        self.orderCodeLabel.text = @"订单编号: 201603024435";
        
        self.orderCodeLabel.textColor = BHColor(51, 51, 51);
        self.orderCodeLabel.font = BHFont(15);
        self.orderCodeLabel.textAlignment = NSTextAlignmentLeft;
        
        [self.orderCodeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self).with.offset(15);
            make.centerY.equalTo(self).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW/2+20, 25));
        }];
        
        self.iconImg = [[UIImageView alloc]init];
        [self.contentView addSubview:self.iconImg];
        
        [self.iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.orderCodeLabel.mas_trailing).with.offset(5);
            make.centerY.equalTo(self).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(25, 25));
        }];
        
        UIView * lineView = [[UIView alloc]init];
        [self.contentView addSubview:lineView];
        lineView.backgroundColor = BHColor(230, 230, 230);
        
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self).with.offset(0);
            make.bottom.equalTo(self).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW, 1));
        }];
        
    }
    return self;
}

@end
